package com.huihua.it.mapper;

import com.huihua.it.vo.ResourceVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface ResourceMapper {

    @Select("SELECT `RESOURCE_ID` resourceId,\n" +
            "  `NAME` name,\n" +
            "  `TEXT` text,\n" +
            "  `LANGUAGE` language,\n" +
            "  `DESCRIPTION` description,\n" +
            "  `DELETED` deleted,\n" +
            "  `REVISION` revision,\n" +
            "  `CREATED_BY` createdBy,\n" +
            "  `CREATED_TIME` createdTime,\n" +
            "  `UPDATED_BY` updatedBy,\n" +
            "  `UPDATED_TIME` updatedTime FROM RESOURCE WHERE DELETED=0 AND COUNTRY=#{lang}")
    List<ResourceVO> selectByLanguageList(@Param("lang") String lang);

    @Select("SELECT `RESOURCE_ID` resourceId,\n" +
            "  `NAME` name,\n" +
            "  `TEXT` text,\n" +
            "  `LANGUAGE` language,\n" +
            "  `DESCRIPTION` description,\n" +
            "  `DELETED` deleted,\n" +
            "  `REVISION` revision,\n" +
            "  `CREATED_BY` createdBy,\n" +
            "  `CREATED_TIME` createdTime,\n" +
            "  `UPDATED_BY` updatedBy,\n" +
            "  `UPDATED_TIME` updatedTime FROM RESOURCE WHERE DELETED=0")
    List<ResourceVO> selectLangList();
}
